home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Dreamweaver 3 / Configuration / Behaviors / Actions / Popup Message.js < prev    next >
Encoding:
Text File  |  1999-12-01  |  1.6 KB  |  74 lines

  1. // Copyright 1999 Macromedia, Inc. All rights reserved.
  2.  
  3. //*************** GLOBALS VARS *****************
  4.  
  5. var helpDoc = MM.HELP_behPopupMessage;
  6.  
  7. //******************* BEHAVIOR FUNCTION **********************
  8.  
  9. //Passed a expression string, pops it up in an alert.
  10.  
  11. function MM_popupMsg(msg) { //v1.0
  12.   alert(msg);
  13. }
  14.  
  15.  
  16. //******************* API **********************
  17.  
  18.  
  19. //Can be used with any tag and any event
  20.  
  21. function canAcceptBehavior(){
  22.   var retVal = "onClick,onMouseUp,onMouseDown,(onClick)";
  23.   return retVal;
  24. }
  25.  
  26.  
  27.  
  28. //Returns a Javascript function to be inserted in HTML head with script tags.
  29.  
  30. function behaviorFunction(){
  31.   return "MM_popupMsg";
  32. }
  33.  
  34.  
  35.  
  36. //Returns fn call to insert in HTML tag <TAG... onEvent='thisFn(arg)'>
  37.  
  38. function applyBehavior() {
  39.   var index,frameObj,presBg,msgStr="",retVal;
  40.   with (document.theForm) {
  41.     msgStr = escExprStr(message.value,false);
  42.   }
  43.   if (msgStr == null) retVal = MSG_BadBraces;
  44.   else if (msgStr) retVal = "MM_popupMsg('"+msgStr+"')";
  45.   else retVal = MSG_NoMsg;
  46.   return retVal
  47. }
  48.  
  49.  
  50.  
  51. //Passed the function call above, takes prior arguments and reloads the UI.
  52. //Removes any escape characters "\"
  53.  
  54. function inspectBehavior(fnStr){
  55.   var argArray, msgStr;
  56.  
  57.   argArray = extractExprStr(fnStr);
  58.   if (argArray.length == 1) { //expect 1 arg
  59.     document.theForm.message.value = unescExprStr(argArray[0],false);
  60.   }
  61. }
  62.  
  63.  
  64.  
  65. //***************** LOCAL FUNCTIONS  ******************
  66.  
  67.  
  68. //Load up the frames, set the insertion point
  69.  
  70. function initializeUI(){
  71.   document.theForm.message.focus(); //set focus on textbox
  72.   document.theForm.message.select(); //set insertion point into textbox
  73. }
  74.